React Router Quick Start Guide by Sagar Ganatra

React Router Quick Start Guide by Sagar Ganatra

Author:Sagar Ganatra
Language: eng
Format: epub
Tags: COM060080 - COMPUTERS / Web / General, COM051260 - COMPUTERS / Programming Languages / JavaScript, COM051390 - COMPUTERS / Programming / Open Source
Publisher: Packt Publishing
Published: 2018-09-28T14:05:43+00:00


By wrapping a list of <Route> components inside a <Switch> component, React-Router sequentially searches for a <Route> matching the browser's URL path. Once a matching <Route> is found, <Switch> stops the search and renders the matching <Route>.

In the preceding example, the first <Route> in <Switch> is rendered only if the browser's URL path is /login and paths other than /login (/123, /products, /stocks and so on) would match the second route and render the corresponding component.

If the order of the previous two <Route> components is swapped (that is, the <Route> with path /:id is listed above the <Route> with path /login), the <Route> with path /login would never get rendered because <Switch> allows only one and the first matching route to be rendered.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.